package thread;

/**
 * 死锁测试，两个线程相互等待
 * @author apple
 *
 */
public class JoinDeadLockTest {

	public static void main(String[] args) throws InterruptedException {
		
		final Thread mainThread = Thread.currentThread();
		Thread t = new Thread(){

			@Override
			public void run() {
				
				try {
					mainThread.join();
					System.out.println("子线程完毕");
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		};
		t.start();
		t.join(); //哪个线程条用join，哪个线程就会等t执行完才执行
		
		System.out.println("主线程完毕");
	}
}
